<%@ page isELIgnored="false" %>
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
        <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
            <%@ page import="java.util.Map" %>
                <%@ page import="java.util.HashMap" %>
                    <%@ page import="java.util.Set" %>
                        <!DOCTYPE html>
                        <html>

                        <head>
                            <base href="<%=request.getContextPath() %>/">
                            <title>投票列表</title>
                            <link rel="stylesheet" href="css/addNewtp.css" />
                            <script type="text/javascript" src="js/jquery-1.x.js"></script>
                            <script type="text/javascript" src="js/changeH.js"></script>
                            <style>
                                table {
                                    width: 100%;
                                    border-collapse: collapse;
                                    margin: 25px 0;
                                    font-size: 18px;
                                    text-align: left;
                                }

                                th,
                                td {
                                    padding: 12px;
                                    border-bottom: 1px solid #ddd;
                                }

                                th {
                                    background-color: #f4f4f4;
                                }
                            </style>
                        </head>

                        <body>
                            <div id="pc">
                                <div class="head">
                                    <div class="navBox">
                                        <div class="logo">
                                            <input type="image" src="img/headlogo.png"
                                                style="margin-left:200px;width:300px;height:80px" />
                                        </div>
                                        <div class="nav">
                                            <ul>
                                                <li id="din">
                                                    <a href="/VoteWeb/articleListServlet">投票列表</a>
                                                </li>
                                                <li class="seleLi">
                                                    <a href="admin/addNewtp.jsp">添加新投票</a>
                                                </li>
                                                <li>
                                                    <a href="articleListServlet?flag=me">维护</a>
                                                </li>
                                                <li>
                                                    <a href="Statistics">统计分析</a>
                                                </li>
                                            </ul>
                                            <div class="an">
                                                <a class="esta" href="javascript:(0)">你好，${sessionScope.username}</a>
                                            </div>
                                            <div class="an3"><a href="/VoteWeb/logout">注销</a></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="third">

                                    <h2>投票数量最多的前6</h2>
                                    <table>
                                        <thead>
                                            <tr>
                                                <th>用户名</th>
                                                <th>参与投票数</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <% @SuppressWarnings("unchecked") Map<String, Integer> userVoteCount = (Map
                                                <String, Integer>) request.getAttribute("userVoteCount");
                                                    if (userVoteCount != null && !userVoteCount.isEmpty()) {
                                                    for (Map.Entry<String, Integer> entry : userVoteCount.entrySet()) {
                                                        %>
                                                        <tr>
                                                            <td>
                                                                <%= entry.getKey() %>
                                                            </td>
                                                            <td>
                                                                <%= entry.getValue() %>
                                                            </td>
                                                        </tr>
                                                        <% } } else { %>
                                                            <tr>
                                                                <td colspan="2">没有数据</td>
                                                            </tr>
                                                            <% } %>
                                        </tbody>
                                    </table>

                                    <h2>热门投票项目前6</h2>
                                    <table>
                                        <thead>
                                            <tr>
                                                <th>投票项目</th>
                                                <th>投票数量</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <% @SuppressWarnings("unchecked") Map<String, Integer> articleVoteCount =
                                                (Map<String, Integer>) request.getAttribute("articleVoteCount");
                                                    if (articleVoteCount != null && !articleVoteCount.isEmpty()) {
                                                    for (Map.Entry<String, Integer> entry : articleVoteCount.entrySet())
                                                        {
                                                        %>
                                                        <tr>
                                                            <td>
                                                                <%= entry.getKey() %>
                                                            </td>
                                                            <td>
                                                                <%= entry.getValue() %>
                                                            </td>
                                                        </tr>
                                                        <% } } else { %>
                                                            <tr>
                                                                <td colspan="2">没有数据</td>
                                                            </tr>
                                                            <% } %>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="bottom"></div>
                        </body>

                        </html>